/*

	RLE
	---

	Run-Length-Encoding algorithm

	Remarks:
	But the authors of the BWT, Michael Burrows and David Wheeler
	recommended that data should be crunched in such an order:
	Data -> (maybe a simple RLE cruncher ->) BWT -> MTF -> Huffman or Arithmetic Cruncher
	

	This is an algorithm crunching the incoming bytes by compressing
	rows of similar symbols. The idea is ripped from the IFF picture format
	from the time when Amigas were hip. It was explained in the compression
	article collection of Joa. Thanks man!

	The data is managed in blocks. Each block is prefixed by a byte value. Is
	the highest bit not set then it's the count of the uncompressed bytes, following
	the prefix byte. In the other case the rest of this byte presents the number
	of same bytes. The repeated byte can be found after the identification byte.

	Remarks II:
	RLE::Encode just preforms the RLE compression, and returns TRUE if
	the output buffer is smaller than the input buffer size. Doesn't produce the
	compression process a benefit then the input buffer remains unchanged and
	FALSE is returned.


	by yoda

	WWW:      y0da.cjb.net
	E-mail:   LordPE@gmx.net

	You are allowed to use this source code in your own projects if you mention
	my name.

*/

#pragma once

#include <windows.h>

//
// RLE class
//
class RLE  
{
public:
	static BOOL Encode( PBYTE pData, DWORD cb, DWORD &cbNew );
	static BOOL Decode( PBYTE &pData, DWORD &cb );
};

typedef RLE *PRLE;
